import Vue from 'vue'
import Vuex from 'vuex'
import { $__model } from "./assets/js/public/store"
Vue.use(Vuex)
//全局控制是否启动sess存储 默认不启动
const sessAuto = false;
// sess缓存镜像
let sess = {};
// store state对象
const state = {
	name: 123
};
// 判断 是否进行缓存同步
if (sessAuto) {
	sess = window.sessionStorage;
	sess.state = JSON.stringify(Object.assign(state || {}, JSON.parse(sess.state || "{}")));
}

const _vuex = new Vuex.Store({
	state,
	mutations: {
		$model(state, params) {
			$__model(state, params, { sess, sessAuto });
		}
	},
	actions: {}
});

export { _vuex as default, state }
